namespace SolidMvvmLite {
	/// <summary>
	///     Derive your view model from this class if you need the option of saving your
	///     work before being disposed or of denying the ability to be disposed.
	/// </summary>
	public abstract class ApplicationViewModelBase : CloseableViewModelBase, IApplicationViewModelBase {
		public delegate void ApplicationExitRequestedDelegate(IApplicationViewModelBase sender);

		protected ApplicationViewModelBase(IApplicationContext applicationContext, IMessageReporter messageReporter, ApplicationExitRequestedDelegate applicationExitRequestedDelegate) : base(messageReporter) {
			ApplicationExitRequested = applicationExitRequestedDelegate;
			ApplicationContext = applicationContext;
		}

		public ApplicationExitRequestedDelegate ApplicationExitRequested { get; private set; }

		public IApplicationContext ApplicationContext { get; private set; }

		public override void Dispose() {
			ApplicationContext = null;
			ApplicationExitRequested = null;

			base.Dispose();
		}
	}
}
